package com.swak.define;

import java.time.LocalDateTime;

import com.swak.Constants;
import com.swak.utils.time.DateTimes;

/**
 * 定义Sql 中的一些常量
 * 
 * @author lifeng
 * @date 2021年1月22日 上午10:10:06
 */
public interface CurdDefine {

	String SCRIPT_START = "<script>";
	String SCRIPT_END = "</script>";
	String WHERE_START = "<where>";
	String WHERE_END = "</where>";
	String SET_START = "<set>";
	String SET_END = "</set>";
	String IF_START = "<if test=\"%s\">";
	String IF_END = "</if>";
	String SELECT = "SELECT";
	String INSERT = "INSERT INTO";
	String INSERT_IGNORE = "INSERT IGNORE INTO";
	String UPDATE = "UPDATE";
	String DELETE = "DELETE";
	String FROM = "FROM";
	String TABLE = "TABLE";
	String SET = "SET";
	String WHERE = "WHERE";
	String ORDER_BY = "ORDER BY";
	String DESC = "DESC";
	String ASC = "ASC";
	String EQUALS = " = ";
	String OCCUPIED = "?";
	String SPACE = " ";
	String SPLIT = ", ";
	String AND = " AND ";
	String OR = " OR ";
	String LEFT_BRACKET = "(";
	String RIGHT_BRACKET = ")";
	String RIGHT_BRACE = "}";
	String VALUES = "VALUES";
	String COUNT = "COUNT(1) C";
	String LOCK = "FOR UPDATE";
	String REPLACE = "ON DUPLICATE KEY";
	String EXISTS = "SELECT COUNT(1) C FROM SYS_DUAL WHERE EXISTS ( SELECT 1 FROM ";
	String STAT_CHECK = "(CASE WHEN %s IS NULL THEN 0 ELSE %s END)";
	String TOGGLE_CHECK = "(CASE WHEN %s IS NULL OR %s = 0 THEN 1 ELSE 0 END)";
	String MAX_CHECK = "(CASE WHEN (CASE WHEN %s IS NULL THEN 0 ELSE %s END) > #{%s} THEN %s ELSE #{%s} END)";
	String MIN_CHECK = "(CASE WHEN (CASE WHEN %s IS NULL THEN 0 ELSE %s END) < #{%s} THEN %s ELSE #{%s} END)";
	String OP_LOCK_ADD = "VERSION = (CASE WHEN VERSION IS NULL THEN 0 ELSE VERSION END) + 1";
	String OP_LOCK_CHECK = "AND VERSION = #{version}";
	String PADDING = "1=1";
	String PADDING2 = "DEL_FLAG=0";
	String DEL_FLAG = "DEL_FLAG";
	String DEL_AT = "DEL_AT";
	String DOLLAR_LEFT_BRACE = "${";
	String HASH_LEFT_BRACE = "#{";
	String AMPERSAND = "&";
	String AT = "@";
	String ASTERISK = "*";
	String STAR = ASTERISK;
	String BACK_SLASH = "\\";
	String COLON = ":";
	String COMMA = ",";
	String DASH = "-";
	String DOLLAR = "$";
	String DOT = ".";
	String DOTDOT = "..";
	String DOT_CLASS = ".class";
	String DOT_JAVA = ".java";
	String DOT_XML = ".xml";
	String EMPTY = "";
	String FALSE = "false";
	String SLASH = "/";
	String HASH = "#";
	String HAT = "^";
	String LEFT_BRACE = "{";
	String LEFT_CHEV = "<";
	String DOT_NEWLINE = ",\n";
	String NEWLINE = "\n";
	String N = "n";
	String NO = "no";
	String NULL = "null";
	String OFF = "off";
	String ON = "on";
	String PERCENT = "%";
	String PIPE = "|";
	String PLUS = "+";
	String QUESTION_MARK = "?";
	String EXCLAMATION_MARK = "!";
	String QUOTE = "\"";
	String RETURN = "\r";
	String TAB = "\t";
	String RIGHT_CHEV = ">";
	String SEMICOLON = ";";
	String SINGLE_QUOTE = "'";
	String BACKTICK = "`";
	String TILDA = "~";
	String LEFT_SQ_BRACKET = "[";
	String RIGHT_SQ_BRACKET = "]";
	String TRUE = "true";
	String UNDERSCORE = "_";
	String UTF_8 = "UTF-8";
	String US_ASCII = "US-ASCII";
	String ISO_8859_1 = "ISO-8859-1";
	String Y = "y";
	String YES = "yes";
	String ONE = "1";
	String ZERO = "0";
	String CRLF = "\r\n";
	String HTML_NBSP = "&nbsp;";
	String HTML_AMP = "&amp";
	String HTML_QUOTE = "&quot;";
	String HTML_LT = "&lt;";
	String HTML_GT = "&gt;";
	String Lock_Sql_Statement = "lock";
	String TypeHandlerEl = "typeHandler=";
	String FUNC_Rand = "RAND()";
	String MODEL = "model";
	
	/**
	 * 查询条件的预编译参数
	 */
	String WRAPPER_PARAM = "MPGENVAL";
	String WRAPPER_PARAM_MIDDLE = "paramNameValuePairs" + DOT;

	/**
	 * 属性
	 */
	String IdProperty = "id";
	String delFlagProperty = "delFlag";
	String delAtProperty = "delAt";
	String versionProperty = "version";

	/**
	 * 固定的日期时间
	 */
	LocalDateTime FixDelAt = DateTimes.getDateTimeOfTimestamp(Constants.Fix_Time);

	/**
	 * Hint
	 */
	String Hint = "hint";
	String Hint_MergeUpdateFlag = "hint.mergeUpdateFlag";
	String Hint_IgnoreInsertFlag = "hint.ignoreInsertFlag";
}
